//传统
// let person = {
//   username: 'Tom',
//   age: 2,
//   sing: function () {
//     console.log('I love Jerry')
//   },
// }

//用变量的形式来表现
// let username1 = 'Tom'
// let age1 = 2
// let sing1 = function () {
//   console.log('I love Jerry')
// }
// let person = {
//   username: username1,
//   age: age1,
//   sing: sing1,
// }

// console.log(person.username)
// console.log(person.age)
// person.sing()

//当且仅当前面的变量和后面的属性名一致时，可以将变量和属性合并为一个关键字
let username = 'Tom'
let age = 2
let sing = function () {
  console.log('I love Jerry')
}
let person = {
  username,
  age,
  sing,
}

console.log(person.username)
console.log(person.age)
person.sing()
